package com.ipet.app.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.ipet.app.R;
import com.ipet.app.adapter.ViewHolder.ReplyPostViewHolder;
import com.ipet.app.adapter.ViewHolder.ReplyViewHolder;
import com.ipet.app.bean.HotPost;
import com.ipet.app.bean.ReplyInfo;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

/**
 * Created by jindongping on 16/3/27.
 */
public class ActivityReplyAdapter extends RecyclerArrayAdapter<ReplyInfo> {

    public final int TYPE_POST = 1;
    public final int TYPE_REPLY = 2;
    private HotPost hotPost;

    public ActivityReplyAdapter(Context context, HotPost hotPost) {
        super(context);
        this.hotPost = hotPost;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        switch (viewType) {
            case TYPE_POST:
                return new ReplyPostViewHolder(parent, R.layout.view_reply_post, hotPost);
            case TYPE_REPLY:
                return new ReplyViewHolder(parent, R.layout.view_reply);
        }
        return null;
    }

    @Override
    public int getViewType(int position) {
        if (position == 0) {
            return TYPE_POST;
        }
        return TYPE_REPLY;
    }

}
